package com.example.helloworld;

import android.support.v7.app.ActionBarActivity;
import android.view.View;
import android.widget.Button;
import android.os.Bundle;

public class MainActivity extends ActionBarActivity {
	
	@Override
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		setContentView(R.layout.activity_main);
		Button nextButton = (Button)findViewById(R.id.next);
		nextButton.setOnClickListener(new View.OnClickListener() {

            
			@Override
			public void onClick(View v) {
				// TODO Auto-generated method stub
				nextLayout();
			}

			private void nextLayout() {
				// TODO Auto-generated method stub
				setContentView(R.layout.two);
				Button preButton = (Button)findViewById(R.id.pre);
				preButton.setOnClickListener(new View.OnClickListener() {
					
					@Override
					public void onClick(View v) {
						// TODO Auto-generated method stub
						preLayout();
					}

					private void preLayout() {
						// TODO Auto-generated method stub
						setContentView(R.layout.activity_main);
						Button nextButton = (Button)findViewById(R.id.next);
						nextButton.setOnClickListener(new View.OnClickListener() {
							
							@Override
							public void onClick(View v) {
								// TODO Auto-generated method stub
								nextLayout();
							}
						});
					}
				});
			}
		});
	}
	
}

